CFLAGS = -Wall -fpic -coverage -lm -std=c99

default: unittestresults.out

unittestresults.out: unittest1.c unittest2.c unittest3.c unittest4.c cardtest1.c cardtest2.c cardtest3.c cardtest4.c dominion/dominion.c dominion/interface.c dominion/rngs.c
	rm -f unittestresults.out
	rm -f *.gcda *.gcno *.gcov
	echo "Result for running Dominion Function tests:" >> unittestresults.out
	
	echo "unittest1.c:" >> unittestresults.out
	gcc -o unittest1 dominion/dominion.c dominion/interface.c dominion/rngs.c  unittest1.c $(CFLAGS)
	./unittest1 >> unittestresults.out

	echo “unittest2.c:” >> unittestresults.out
	gcc -o unittest2 dominion/dominion.c dominion/interface.c dominion/rngs.c  unittest2.c $(CFLAGS)
	./unittest2 >> unittestresults.out

	echo “unittest3.c:” >> unittestresults.out
	gcc -o unittest3 dominion/dominion.c dominion/interface.c dominion/rngs.c  unittest3.c $(CFLAGS)
	./unittest3 >> unittestresults.out

	echo “unittest4.c:” >> unittestresults.out
	gcc -o unittest4 dominion/dominion.c dominion/interface.c dominion/rngs.c  unittest4.c $(CFLAGS)
	./unittest4 >> unittestresults.out

	echo “cardtest1.c:” >> unittestresults.out
	gcc -o cardtest1 dominion/dominion.c dominion/interface.c dominion/rngs.c  cardtest1.c $(CFLAGS)
	./cardtest1 >> unittestresults.out

	echo “cardtest2.c:” >> unittestresults.out
	gcc -o cardtest2 dominion/dominion.c dominion/interface.c dominion/rngs.c  cardtest2.c $(CFLAGS)
	./cardtest2 >> unittestresults.out

	echo “cardtest3.c:” >> unittestresults.out
	gcc -o cardtest3 dominion/dominion.c dominion/interface.c dominion/rngs.c  cardtest3.c $(CFLAGS)
	./cardtest3 >> unittestresults.out

	echo “cardtest4.c:” >> unittestresults.out
	gcc -o cardtest4 dominion/dominion.c dominion/interface.c dominion/rngs.c  cardtest4.c $(CFLAGS)
	./cardtest4 >> unittestresults.out

	echo “gcov results:” >> unittestresults.out

	gcov -b dominion.c >> unittestresults.out
	
clean:
	rm -f unittestresults.out

cleanall: 
	rm -f unittestresults.out unittest1 unittest2 unittest3 unittest4 cardtest1 cardtest2 cardtest3 cardtest4 *.gcda *.gcno *.gcov
